home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 9138 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.5 KB

  1. Path: surfnet.nl!sun4nl!xs4all!falstaff
  2. From: falstaff@xs4all.nl (Falstaff)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Standard question - pointer initialization
  5. Date: 6 Mar 1996 23:24:43 GMT
  6. Organization: XS4ALL, networking for the masses
  7. Message-ID: <4hl6rr$nde@news.xs4all.nl>
  8. References: <4hk9un$906@hammer.msfc.nasa.gov>
  9. NNTP-Posting-Host: xs1.xs4all.nl
  10. X-Newsreader: NN version 6.5.0 #666 (NOV)
  11.  
  12. Brian.Day@msfc.nasa.gov (Brian Day) writes:
  13.  
  14. >Hi all,
  15.  
  16. >I don't have a copy of the ANSI standard handy, and was wondering
  17. >if y'all could answer a question for me.
  18.  
  19. >We were recently handed a coding standard which said:
  20.  
  21. >    "Always initialize pointers when they are declared" 
  22.  
  23. >Doesn't the standard say something about some pointers
  24. >being automatically initialized to NULL, or something like that?
  25.  
  26. No.  Pointers like any other variables are not automagically initialized.
  27.  
  28. >Is this coding standard wise?
  29.  
  30. Even though using uninitialized pointers may lead to crashing your
  31. system (especially non-memory-managed systems) faster than other
  32. uninitialized variables, both omissions will lead to errors in the
  33. program.
  34. Compilers may help in detecting uninitialized variables, but otherwise
  35. good programming practises should be followed to try to eliminate
  36. these errors before they are programmed in.
  37.  
  38. Frank
  39. --
  40. The famous GIICM now on line:  http://www.xs4all.nl/~falstaff/GIICM.html
  41. ------------------------------------------------------------------------
  42. Frank A. Vorstenbosch        +31-(70)-355 5241        falstaff@xs4all.nl
  43.